package com.mentaleye.dal.dao.mybatis;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.mentaleye.dal.dao.WorkTimeDao;
import com.mentaleye.dal.dao.mybatis.BaseDao;
import com.mentaleye.dal.model.Worktime;
import com.mentaleye.dal.model.WorktimeExample;
import com.mentaleye.dal.service.WorktimeMapper;
@Repository
public class WorkTimeDaoImpl extends BaseDao implements WorkTimeDao {
	@Autowired private WorktimeMapper worktimeMapper;
	public boolean addWorktime(Worktime worktime) {
		
		return getResultByInt(worktimeMapper.insert(worktime));
	}

	public boolean editWorktime(Worktime worktime) {
		
		return getResultByInt(worktimeMapper.updateByPrimaryKeySelective(worktime));
	}

	public boolean updateWorktimeByList(List<Integer> ids, Worktime worktime) {
		
		WorktimeExample example=new WorktimeExample();
		example.createCriteria().andWorktimeNoIn(ids);
		return getResultByInt(worktimeMapper.updateByExampleSelective(worktime, example));
	}

	public List<Worktime> queryWorktimeByPage(Map<String, Object> map) {
		
		return worktimeMapper.selectByMap(map);
	}

	public List<Worktime> select(WorktimeExample example) {
		
		return worktimeMapper.selectByExample(example);
	}

	public Worktime queryWorktime(Integer worktimeNo) {
		
		return worktimeMapper.selectByPrimaryKey(worktimeNo);
	}

	public boolean deleteWorktime(List<Integer> ids) {
		WorktimeExample example=new WorktimeExample();
		example.createCriteria().andWorktimeNoIn(ids);
		return getResultByInt(worktimeMapper.deleteByExample(example));
	}

	public boolean deleteWorktimeNotIn(List<Integer> ids) {
		
		WorktimeExample example=new WorktimeExample();
		example.createCriteria().andWorktimeNoNotIn(ids);
		return getResultByInt(worktimeMapper.deleteByExample(example));
	}

}
